#ifdef DEBUG
#define DEBUG_LOG(format, ...) NSLog((@"%@(%d)%s:\n" format), [[NSString stringWithCString:__FILE__ encoding:NSASCIIStringEncoding] lastPathComponent], __LINE__, __FUNCTION__, ##__VA_ARGS__)
#else
#define DEBUG_LOG(format, ...)
#endif
#define WHERE DEBUG_LOG(@"WHERE");
#define SSJKString(a) (a) ? [(a) description] : @""
#define kString_Null                        @"null"
#define kString_Null_IOS                    @"(null)"

#define deviceWidth [UIScreen mainScreen].bounds.size.width
#define deviceHeight [UIScreen mainScreen].bounds.size.height
#define topBarHeight 44
#define tabBarHeight 49
#define toolbarHeight 44
#define gLineWidthOrHeight  0.25f

#define SafeRelease(a) if (a) {[a release]; a = nil;}
#define RemoveAllSubviews(view) for (UIView *subview in view.subviews) [subview removeFromSuperview];
#define WeakSelf __weak typeof(self) weakSelf = self;

#define UIColorFromRGBA(rgbValue, a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
#define UIColorFromRGB(rgbValue)  UIColorFromRGBA(rgbValue,1.0)

#define APPDisplayName [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"]
#define APPVersionName [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]
#define APPVersionCode [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"]
#define kAppVersionKey @"AppVersion"
#define User_Default [NSUserDefaults standardUserDefaults]

//检查数组下标获取数组对象 无效下标返回nil
#define safeGetArrayObject(array, index)    \
index<[array count]?[array objectAtIndex:index]:nil; \
//    if ([array count] <= index) \
//    {   \
//        DEBUG_LOG(@"invalid array index:%@, count%@! file:%s, line:%d", @(index), @([array count]), __FILE__, __LINE__); \
//    }

typedef enum {
    Method_Get = 1,  //Get
    Method_Post = 2, //Post
} RequestMethod;

#define topBarColor UIColorFromRGB(0x2D9AEC)
#define GAP20 20

typedef void (^NoparamBlock)();
typedef void (^IndexBlock)(NSInteger index);
typedef void (^ObjectBlock)(id obj);
